package com.situ.store.service.impl;

import java.util.List;

import com.situ.store.dao.GoodsDao;
import com.situ.store.entity.Goods;
import com.situ.store.service.GoodsService;

public class GoodsServiceImpl implements GoodsService {

	GoodsDao dao = new GoodsDao();

	// 增改
	@Override
	public void save(Goods goods) {
		if (goods.getId() == null) {
			dao.add(goods);
		} else {
			dao.edit(goods);
		}
	}

	// 删
	@Override
	public void del(Integer id) {
		dao.del(id);
	}

	// 查
	@Override
	public List<Goods> selectAll(Integer pageSize, Integer pageNum, String keyword1, String keyword2) {
		return dao.selectAll((pageSize - 1) * pageNum, pageNum, keyword1, keyword2);
	}

	@Override
	public Goods selectById(Integer id) {
		return dao.selectById(id);
	}

	// 分页
	@Override
	public Long count(String keyword1, String keyword2) {
		return dao.count(keyword1, keyword2);
	}
	
	@Override
	public List<Goods> selectName() {
		return dao.selectName();
	}
	
	@Override
	public List<Goods> selectFactory() {
		return dao.selectFactory();
	}
	

}
